﻿using System;
using BikeBouncer.BusinessLayer.Entities;

namespace BikeBouncer.Site
{
	public partial class BikeStatus_aspx : BasePage
	{
		#region Main methods

		protected void Page_Load(Object sender, EventArgs e)
		{
			LoadBike(Item.KeyToId(Request.QueryString["bike"]));
		}

		private void LoadBike(Int32 id)
		{
			Item item = new Item(id);

			if (item.Id < 1)
			{
				DataInvalidRedirect();
			}

			Title = GetLocalResourceObject("PageTitle") + ": " + item.Title;
			H1 = GetLocalResourceObject("PageH1") + ": " + item.Title;

			String serial = String.IsNullOrEmpty(item.Serial) ? "?" : item.Serial;
			Description = GetLocalResourceObject("PageDescription") + "Bike " + item.Title + ", serial " + serial;
		}

		#endregion
	}
}